package org.example.jnautil.key;

import java.util.concurrent.BlockingQueue;

public interface RegisteredKey {
    String keyId();

    boolean isRunning();

    boolean isBlocking();

    BlockingQueue<String> getQueue();

    default KeyCodeEnum firstKey() {
        String id = keyId();
        KeyCodeEnum[] keyCodeEnums = KeyCodeEnum.splitName(id);
        if (keyCodeEnums.length > 0) {
            return keyCodeEnums[0];
        }
        return null;
    }

    default KeyCodeEnum secondKey() {
        String id = keyId();
        KeyCodeEnum[] keyCodeEnums = KeyCodeEnum.splitName(id);
        if (keyCodeEnums.length > 1) {
            return keyCodeEnums[1];
        }
        return null;
    }

}
